{extends file="../header_footer.html"} 

{block name=content}
{if !$is_email_register}
<div class="cms_user">
    <div class="wrap">
        {if $error}<div class="error">{reset($error)}</div>{/if}
        {$form->create(['type' => 'post', 'class' => 'layui-form layui-form-pane'])}
          <div class="layui-form-item">
            <label class="layui-form-label">账　　号</label>
            <div class="layui-input-inline">
              {$form->text("User.username",['class'=>'layui-input','placeholder'=>'请输入账号','autocomplete'=>'off'])}
            </div>
            
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">密　　码</label>
            <div class="layui-input-inline">
              {$form->password("User.password",['class'=>'layui-input','placeholder'=>'请输入密码','autocomplete'=>'off'])}
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-inline">
              {$form->password("User.repassword",['class'=>'layui-input','placeholder'=>'请确认密码','autocomplete'=>'off'])}
            </div>
          </div>
          {if setting('is_email_verify')}
          <div class="layui-form-item">
            <label class="layui-form-label">邮　　箱</label>
            <div class="layui-input-inline">
              {$form->text("User.email",['class'=>'layui-input','placeholder'=>'请输入邮箱','autocomplete'=>'off'])}
            </div>
          </div>
          {/if}
          <div class="layui-form-item">
            <label class="layui-form-label">验证码</label>
            <div class="layui-input-inline captcha">
              {$form->text("captcha",['class'=>'layui-input',name=>'captcha','value'=>'','autocomplete'=>'off','placeholder'=>'请输入验证码'])}
              <span class="vimg"><img  src="{captcha_src()}" class="tooltip" onclick="this.src='{captcha_src()}?'+Math.random()"/></span>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-input-inline">
              <button class="layui-btn" lay-submit lay-filter="formDemo">立即注册</button>
            </div>
          </div>
        {$form->end()}
    </div>
</div>
<script>
//  ajax 验证：如果需要自行处理，后台功能已经准备好
$('#UserUsername').blur(function(){
    var val  = $.trim($(this).val());
    if (val) {
        $.get("{url('User/check_username')}", { username:val}, function(data){
            data = $.parseJSON(data);
            console.log(data)
        })
    }
})
</script>
{else}
<p style="text-align: center;font-size: 30px;padding: 100px 0;">贡献您已经注册成功！请登录你的邮箱激活帐号。</p>
{/if}
{/block}